import request from '@/utils/request'

// 获取优惠券列表
export function pageCoupon(query) {
  return request({
    url: '/sell/coupon/paging',
    method: 'get',
    params: query
  })
}

// 已选未选优惠券分页查询
export function pageSelectCoupon(query) {
  return request({
    url: '/sell/coupon/pageSelectCoupon',
    method: 'get',
    params: query
  })
}

// 统计优惠券
export function statCoupon(query) {
  return request({
    url: '/sell/coupon/statCoupon',
    method: 'get',
    params: query
  })
}

// 获取优惠券
export function getCoupon(couponId) {
  return request({
    url: '/sell/coupon/get',
    method: 'get',
    params: { couponId }
  })
}

// 保存优惠券
export function saveCoupon(coupon) {
  return request({
    url: '/sell/coupon/save',
    method: 'post',
    data: coupon
  })
}

// 发布优惠券
export function publishCoupon(couponId) {
  return request({
    url: '/sell/coupon/doPublish',
    method: 'post',
    params: { couponId }
  })
}

// 结束优惠券
export function endCoupon(coupon) {
  return request({
    url: '/sell/coupon/doEnd',
    method: 'post',
    params: coupon
  })
}

// 删除优惠券
export function deleteCoupon(couponId) {
  return request({
    url: '/sell/coupon/delete',
    method: 'post',
    params: { couponId }
  })
}

// 优惠券使用明细分页
export function pageMemberCoupon(query) {
  return request({
    url: '/sell/coupon/pagingMemberCoupon',
    method: 'get',
    params: query
  })
}

// 统计优惠券已使用情况
export function statCouponByUseStatus(query) {
  return request({
    url: '/sell/coupon/statCouponByUseStatus',
    method: 'get',
    params: query
  })
}

// 券汇总报表分页
export function pagingCouponStat(query) {
  return request({
    url: '/sell/coupon/pagingCouponStat',
    method: 'get',
    params: query
  })
}
